package com.xyzwps.paimon.furina.common.value

import com.xyzwps.paimon.furina.common.AppErrorCode
import com.xyzwps.paimon.furina.common.AppException

data class Nickname(override val value: String) : StringValue {
    init {
        if (value.length > MAX_LENGTH) {
            throw AppException(AppErrorCode.NICKNAME_FORMAT_INVALID, "昵称长度不可超过 $MAX_LENGTH 个字符")
        }
    }

    companion object {
        const val MAX_LENGTH: Int = 20

        val EMPTY = Nickname("")
    }

}
